local display = {}

local _director = cc.Director:getInstance()
local _baseSize = {GCg.CC_DESIGN_RESOLUTION.width,GCg.CC_DESIGN_RESOLUTION.height}
local _baseScene = nil
local _winSize = nil

function display.init()
    _baseScene = cc.Scene:create()
    if _director:getRunningScene() then
        _director:replaceScene(_baseScene)
    else
        _director:runWithScene(_baseScene)
    end

    _winSize = _director:getVisibleSize()
    display.winSize = {_winSize.width, _winSize.height}
    _winSize = display.winSize

    local scale = 1
    if _winSize[2]*4 >= _winSize[1]*3 then
        scale = _winSize[1]/1024
    elseif _winSize[2]*3 > _winSize[1]*2 then
        local k = (9 - _winSize[2]*12/_winSize[1])
        scale = _winSize[1]*(1-k)/1024 + _winSize[2]*k/640
    else
        scale = _winSize[2]/640
    end
    local isWide = false
    local hwb = _winSize[2]/_winSize[1]
    if _winSize[2]<=576 or (hwb<=2/3+0.01 and _winSize[2]<=800) or hwb<10/16-0.01 then
        isWide = true
    end
    -- ui.normalScale = scale
    -- ui.isWide = isWide
    -- _dialogDepth = 0
    -- _dialogs = {}
    -- _notices = {}
end

--添加“层”
function display.addLayer(view, depth, tag)
    local node = cc.Node:create()
    _baseScene:addChild(node)
    return view
end

return display